package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysUnionVersiont;
import com.ruoyi.system.service.ISysUnionVersiontService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * unionVersionController
 * 
 * @author ruoyi
 * @date 2024-09-26
 */
@RestController
@RequestMapping("/system/unionversiont")
public class SysUnionVersiontController extends BaseController
{
    @Autowired
    private ISysUnionVersiontService sysUnionVersiontService;

    /**
     * 查询unionVersion列表
     */
    @PreAuthorize("@ss.hasPermi('system:unionversiont:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysUnionVersiont sysUnionVersiont)
    {
        startPage();
        List<SysUnionVersiont> list = sysUnionVersiontService.selectSysUnionVersiontList(sysUnionVersiont);
        return getDataTable(list);
    }

    /**
     * 导出unionVersion列表
     */
    @PreAuthorize("@ss.hasPermi('system:unionversiont:export')")
    @Log(title = "unionVersion", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysUnionVersiont sysUnionVersiont)
    {
        List<SysUnionVersiont> list = sysUnionVersiontService.selectSysUnionVersiontList(sysUnionVersiont);
        ExcelUtil<SysUnionVersiont> util = new ExcelUtil<SysUnionVersiont>(SysUnionVersiont.class);
        util.exportExcel(response, list, "unionVersion数据");
    }

    /**
     * 获取unionVersion详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:unionversiont:query')")
    @GetMapping(value = "/{versionid}")
    public AjaxResult getInfo(@PathVariable("versionid") Long versionid)
    {
        return success(sysUnionVersiontService.selectSysUnionVersiontByVersionid(versionid));
    }

    /**
     * 新增unionVersion
     */
    @PreAuthorize("@ss.hasPermi('system:unionversiont:add')")
    @Log(title = "unionVersion", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysUnionVersiont sysUnionVersiont)
    {
        return toAjax(sysUnionVersiontService.insertSysUnionVersiont(sysUnionVersiont));
    }

    /**
     * 修改unionVersion
     */
    @PreAuthorize("@ss.hasPermi('system:unionversiont:edit')")
    @Log(title = "unionVersion", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysUnionVersiont sysUnionVersiont)
    {
        return toAjax(sysUnionVersiontService.updateSysUnionVersiont(sysUnionVersiont));
    }

    /**
     * 删除unionVersion
     */
    @PreAuthorize("@ss.hasPermi('system:unionversiont:remove')")
    @Log(title = "unionVersion", businessType = BusinessType.DELETE)
	@DeleteMapping("/{versionids}")
    public AjaxResult remove(@PathVariable Long[] versionids)
    {
        return toAjax(sysUnionVersiontService.deleteSysUnionVersiontByVersionids(versionids));
    }
}
